package com.visikard.request;

import com.visikard.application.APIURL;
import com.visikard.net.VkRequestMethod;
import com.visikard.net.VkRestClient;
import com.visikard.utility.VKNetworkException;

public class GoogleGeoRequest extends BaseRequest {

	public String searchAddress(String address) throws VKNetworkException {
		VkRestClient rc = new VkRestClient(String.format(APIURL.PLACE_SEARCH_AUTO_COMPLETE, address,
				"types%20=%20geocode"));
		rc.execute(VkRequestMethod.GET);
		return rc.getResponse();
	}

	public String getDetailAddress(String ref) throws VKNetworkException {
		VkRestClient rc = new VkRestClient(String.format(APIURL.PLACE_DETAIL, ref, "types%20=%20geocode"));
		rc.execute(VkRequestMethod.GET);
		return rc.getResponse();
	}

	public static String searchAddressByLatLng(String lat, String lng) throws VKNetworkException {
		VkRestClient rc = new VkRestClient(String.format(APIURL.GEOCODE_LAT_LONG, String.valueOf(lat),
				String.valueOf(lng)));
		rc.execute(VkRequestMethod.GET);
		return rc.getResponse();
	}
}
